<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Project - Home page</title>
</head>
<body>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<h1><a href="home">Home</a></h1>

<!-- Search form -->
<form method="GET" action="home">
<table>
	<tr>
		<td>Keyword: </td>
		<td><input type="text" size="50" name="keyword" value="${requestScope.keyword}" /></td>
	</tr>
	<tr>
		<td>Location: </td>
		<td>
			<select name="locationId">
				<option value=""><!-- (any) --></option>
				<c:forEach var="l" items="${requestScope.locations}">
					<c:choose>
						<c:when test="${l.id eq requestScope.locationId}">
							<option value="${l.id}" selected="selected">${l.city}</option>
						</c:when>
						<c:otherwise>
							<option value="${l.id}">${l.city}</option>
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</select>
		</td>
	</tr>
	<tr>
		<td>Date: </td>
		<td>
			<input type="text" name="date" value="${requestScope.date}" />
			<span style="font-size:9pt;font-style:italic;">&nbsp;&nbsp;(format: dd/MM/yyyy)</span>
		</td>
	</tr>
	<tr><td><input type="submit" value="Search" /></td></tr>
</table>
</form>

<!-- course list -->
<p>
	<c:forEach var="c" items="${requestScope.courses}">
		<a href="description?code=${c.code}"><c:out value="${c.code} - ${c.title}" /></a><br />
	</c:forEach>
</p>

</body>
</html>